package week4;

/**
 * Created by Administrator on 2016/3/27.
 */
public class RPG3 {
    public static void main(String[] args) {
        SwordsMan3 swordsMan3 = new SwordsMan3();
        swordsMan3.setName("Justin");
        swordsMan3.setLevel(1);
        swordsMan3.setBlood(200);

        Magician3 magician3 = new Magician3();
        magician3.setName("Monica");
        magician3.setLevel(1);
        magician3.setBlood(100);

        drawFight(swordsMan3);//实际操作的是SwordsMan实例
        drawFight(magician3);//实际操作的是Magician实例
    }

    static void drawFight(Role3 role3){//声明为Role类型
        System.out.print(role3.getName());
        role3.fight();
    }
}
